// baseUrl: 'http://b.ido.hpjpw.com/prod-api/'
import loginApi from './api/login.js'
import messageApi from './api/message.js'
import updateUserApi from './api/updateUser.js'
import treasureApi from './api/treasure.js'
import treasureCheckApi from './api/treasureCheak.js'
import relateStudentApi from './api/relateStudent.js'
import homeApi from './api/home.js'
import intershipApi from './api/intership.js'
import imguploadApi from './api/imgUpload.js'
import topicApi from './api/topic.js'
import messageRemindApi from './api/intershipItem/messageRemind.js'

const install = (Vue, vm) => {
	// 导入了login相关的api的函数，并返回各个接口
	let loginApiItem = loginApi(vm)
	let messageApiItem = messageApi(vm)
	let updateUserApiItem = updateUserApi(vm)
	let treasureApiItem = treasureApi(vm)
	let treasureCheckApiItem = treasureCheckApi(vm)
	let relateStudentApiItem = relateStudentApi(vm)
	let homeApiItem = homeApi(vm)
	let intershipItem = intershipApi(vm)
	let imgUploadItem = imguploadApi(vm)
	let topicItem = topicApi(vm)
	let messageRemindItem = messageRemindApi(vm)
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		// 登录相关api
		...loginApiItem,
		// 守护天使聊天的message和消息界面的系统消息api
		...messageApiItem,
		// 用户设置界面更新用户信息api
		...updateUserApiItem,
		// 实习宝藏api
		...treasureApiItem,
		// 实习宝藏审核api
		...treasureCheckApiItem,
		// 关联学生api
		...relateStudentApiItem,
		// 首页api
		...homeApiItem,
		// 实习圈api
		...intershipItem,
		// 七牛云上传获取token,
		...imgUploadItem,
		// 每周主题
		...topicItem,
		// 消息提醒
		...messageRemindItem
	};
	console.log(vm.$u.api)
}

export default {
	install
}
